<%@page import="articles.string.Replace"%>
<%@page import="articles.model.Category"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.text.Format"%>
<%@page import="articles.model.Articles"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html;charset=UTF-8" language="java"%>

<%
	String seo_title = (String)request.getAttribute("seo_title");
	String seo_description = (String) request.getAttribute("seo_description");
	List<Articles> listArticles = (List<Articles>) request.getAttribute("listArticles");	
	String url = (String) request.getAttribute("url");
	String cur_page = (String) request.getAttribute("page");
	String title = (String) request.getAttribute("title");
	String description = (String) request.getAttribute("description");
	String keywords = (String) request.getAttribute("keyword");
	List<Category> category = (List<Category>)request.getAttribute("category");
%>
<jsp:include page="layout/header.jsp">
	<jsp:param name="title" value="<%=title %>"/>
	<jsp:param name="description" value="<%=description %>"/>
	<jsp:param name="keywords" value="<%=keywords %>"/>
</jsp:include>
<div id="content">
	<div id="leftsidecontent">
		<div class="article-listing" itemscope
			itemtype="http://schema.org/ItemList">
			<h1><%=seo_title %></h1>
			<meta itemprop="mainContentOfPage" content="true" />
			<meta itemprop="itemListOrder" content="Descending" />
			<ul>
				<li>
					<jsp:include page="element/adv_one.jsp"></jsp:include>
				</li>
				<%
									Format formatter = new SimpleDateFormat("MM-dd-yy");
									Format formatter1 = new SimpleDateFormat("MM_yyyy");
									if(listArticles.size()>0)
									{
										for(int i=0;i<listArticles.size();i++)
										{
											Articles tmp = listArticles.get(i);
								%>
				<li itemprop="itemListElement" itemscope
					itemtype="http://schema.org/Article">
					<h2 itemprop="name">
						<a itemprop="url" href="/article/<%=tmp.getAlias() %>"
							title="Article <%=Replace.remove(tmp.getTitle()) %>"><%=tmp.getTitle() %></a>
					</h2>
					<p itemprop="description">
						<%
											if(tmp.getContent().getValue().replaceAll("\\<[^<>]+>", "").length()>150)
											{
												out.println(tmp.getContent().getValue().replaceAll("\\<[^<>]+>", "").substring(0,150)+" ...");
											} else {
												out.println(tmp.getContent().getValue().replaceAll("\\<[^<>]+>", ""));
											}
										%>
					</p>
					<p>
						Author : <span class="author" itemprop="author"><a
							href="/author/<%=tmp.getAuthorAlias() %>"
							title="Author <%=Replace.remove(tmp.getAuthor()) %>"
							itemprop="url"><%=tmp.getAuthor() %></a>
						</span> | Date :
						<time datetime="<%=formatter.format(tmp.getDate()) %>">
						<a href="/date/<%=formatter1.format(tmp.getDate()) %>"
							title="Date <%=formatter.format(tmp.getDate()) %>" itemprop="url"><%=formatter.format(tmp.getDate()) %></a></time>
					</p></li>
				<%
										}
									}
                                %>
			</ul>
		</div>
		<ul class="pagination">
			<jsp:include page="paginate.jsp">
				<jsp:param name="cur_page" value="<%=cur_page %>" />
				<jsp:param name="url" value="<%=url %>" />
				<jsp:param name="number_game" value="<%=listArticles.size() %>" />
			</jsp:include>
		</ul>
	</div>
	<div id="rightsidecontent">
		<jsp:include page="element/google_search.jsp"></jsp:include>
		<jsp:include page="element/hatforrent.jsp"></jsp:include>
		<jsp:include page="element/fanpage.jsp"></jsp:include>
		<jsp:include page="element/left.jsp"></jsp:include>
		
		<jsp:include page="element/top_view.jsp"></jsp:include>
		<jsp:include page="element/new_tag.jsp"></jsp:include>
	</div>
	<div class="clearbreak"></div>
</div>
<%@ include file='/layout/footer.jsp'%>